﻿/* 
 *  <copyright file="OnUseEnterLevelCmp.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using System.Collections.Generic;
using SobrietyEngine.Components;
using SobrietyEngine.Actor;
using SobrietyEngine.Events;
using SobrietyEngine.Components.Useable;
using SobrietyEngine.Logging;

using SEGameExample.Events.WorldMap;

namespace SEGameExample.Components.OnUse
{
    class OnUseEnterLevelCmp: UseableBase
    {
        public String LevelName { get; private set; }

        public OnUseEnterLevelCmp()
            : base(0.1f)
        {
        }

        public OnUseEnterLevelCmp(String levelName)
            : base(0.1f)
        {
            LevelName = levelName;
        }

        public override void ForceUse(IActor byWho)
        {
            Logger.Debug(this, byWho.Guid.Value + " ForceUse()'d the level component");
            Actor.EventRouter.RaiseEvent(this, new EnterLevel(LevelName));
        }
    }
}
